<template>
  <div class="address-box">
<!--    <div class="c-i-box">-->
<!--      <div class="fleft choose-input-box">-->
<!--        <span size="30" class="iconfont icon-sousuo"></span>-->
<!--        <input maxlength="15" type="text" class="choose-input" placeholder="请输入订单号" v-model="plotName"/>-->
<!--      </div>-->
<!--      <div class="fright sx-text" @click="showtimediv">筛选</div>-->
<!--      <div class="_clear"></div>-->
<!--    </div>-->
    <div class="add-list-box List">
      <div class="title-box">
        <p>收益情况</p>
      </div>
      <mu-list>
        <mu-list-item v-for="(item,index) in addressList" :key="index">
          <mu-list-item-content>
            <mu-list-item-title>
              <span class="fleft">{{item.plotName}}</span>
              <span class="fright">合计(元)</span>
              <div class="_clear"></div>
            </mu-list-item-title>
            <mu-list-item-sub-title>
              <span class="fleft">{{item.pileCount}}台</span>
              <span class="fright number">{{item.sumOrdergold}}</span>
              <div class="_clear"></div>
            </mu-list-item-sub-title>
          </mu-list-item-content>
        </mu-list-item>
      </mu-list>
      <div v-show="nolist" class="nolist">
          <span class="iconfont icon-charging"></span>
          <p>暂无记录</p>
        </div>
    </div>
    <div class="order-box">
      <timechoose ref="timechoose" v-on:chooseTime="shaixuan"></timechoose>
    </div>
  </div>
</template>

<script>
import timechoose from "@/components/global/timechoose";
export default {
  data() {
    return {
      addressList: [],
      plotName:'',
      startTime: "",
      endTime: "",
      nolist:true,
    };
  },
  components: {
    timechoose: timechoose
  },
  mounted() {
    this.getList();
  },
  methods: {
    showtimediv() {
      console.log(this.$refs.timechoose);
      this.$refs.timechoose.Showtimediv();
    },
    getList() {
      this.$api
        .addressStatistics({ plotName:this.plotName,startTime: this.startTime, endTime: this.endTime })
        .then(res => {
          this.addressList = res.data.data;
        });
    },
    shaixuan(obj){
      this.startTime = obj.startTime;
      this.endTime = obj.endTime;
       this.getList();

    }
  },
    watch:{
      plotName:function(){
         this.getList();
      },
        addressList: function(v) {
      if (v == "") {
        this.nolist = true;
      } else {
        this.nolist = false;
      }
    }
  },
};
</script>

<style>
</style>
